<template>
  <section
    @click="clickCurrent('current')"
    @mousedown="clickCurrent('dragging')"
  >
    <div :class="['custorm--modelbox', 'marketspike-show', (custormCurrent == custormIndex)?'drag active':'drag']">
      <div
        v-if="custormItemData.params.isshow == '2'"
        class="noshow"
        v-bind:style="{'background-image':`url(${getPath('noshow.png')})`}"
      ></div>
      <div style="overflow: hidden;">

        <div
          v-if="custormItemData.style.display == '1'"
          class="es-seckill-group style-row"
        >
          <div class="flex es-seckill-title">
            <p class="title"><span class="seckill-title" v-if="custormItemData.style.text.length > 0">{{custormItemData.style.text}}</span></p>
            <p v-if="custormItemData.style.countdown == '1'"><span>距离活动结束</span><span>19</span>:<span>19</span>:<span>19</span></p>
          </div>
          <div class="group">
            <div>
                <!-- ---- -->
                <div
                v-for="(item, index) in custormItemData.params.choostype == '3'? custormItemData.params.listitem:custormItemData.data && custormItemData.data.length>0?custormItemData.data:custormItemData.params.defaultData"
                :key="index"
                class="es-seckill-col"
              >
                <div class="image"><span v-bind:style="{background:custormItemData.style.iconcolor}">{{custormItemData.style.text}}</span>
                  <img
                    :src="`${custormItemData.params.choostype == '3'?getPath('default_picture.png'):item.edit?getPath(item.edit.thumb):item.image && item.image[0] ? item.image[0].file_path : ''}`"
                    alt=""
                    draggable="false"
                  ></div>
                <div class="detail">
                  <p class="title  line-hide"><span v-if="custormItemData.style.name == '1'">{{(custormItemData.params.choostype == '3'|| custormItemData.params.choostype == '1')?'这里是商品标题':item.edit?item.edit.title:item.goods_name}}</span></p>
                  <div class="subtitle line-hide">
                    <p v-if="custormItemData.params.choostype == '3' || custormItemData.params.choostype == '1'">
                      <span class="sub-price" v-if="custormItemData.style.price == '1'"><span class="icon">￥</span>40.00</span>
                      <span class="sub-price line-through" v-if="custormItemData.style.oldprice == '1'"><span class="icon">仅剩10件</span></span>
                    </p>
                    <p v-if="custormItemData.params.choostype == '2'">
                      <span class="sub-price" v-if="custormItemData.style.price == '1'"><span class="icon">￥</span>{{item.edit?item.edit.price:item.price}}</span>
                      <span class="sub-price line-through" v-if="custormItemData.style.oldprice == '1'"><span class="icon">仅剩{{item.edit?item.edit.sales:item.stock}}件</span></span>
                    </p>
                  </div>

                  <!-- <div class="sales-num">
                    <div class="flex-row flex-justify-b flex-align-c">
                      <div class="flex-col">
                        <p
                        class="num"
                        >还剩{{custormItemData.params.choostype == '1'?'1':item.edit?item.edit.sales:item.sales}}件</p>
                        <p class="progress" v-if="custormItemData.style.progress == '1'"><span class="progress-num"></span></p>
                      </div> -->
                      <!-- <div class="sales-btn flex-row flex-align-c">
                        <span>马上秒</span>
                      </div> -->
                    <!-- </div>
                  </div> -->

                </div>
              </div>
              <!-- ---- -->
            </div>

          </div>
        </div>

        <div
          v-if="custormItemData.style.display == '2'"
          class="es-seckill-group style-col"
        >
          <div class="flex es-seckill-title">
            <p class="title"><span class="seckill-title" v-if="custormItemData.style.text.length > 0">{{custormItemData.style.text}}</span></p>
            <p><span>距离活动结束</span><span>19</span> 时 <span> 19 </span> 分 <span> 19 </span> 秒</p>
          </div>
          <div class="group">
            <div>
                <!-- ---- -->
                <div
                v-for="(item, index) in custormItemData.params.choostype == '3'? custormItemData.params.listitem:custormItemData.data && custormItemData.data.length>0?custormItemData.data:custormItemData.params.defaultData"
                :key="index"
                class="es-seckill-col flex-row"
              >
                <div class="image"><span v-bind:style="{background:custormItemData.style.iconcolor}">{{custormItemData.style.text}}</span>
                  <img
                    :src="`${custormItemData.params.choostype == '3'?getPath('default_picture.png'):item.edit?getPath(item.edit.thumb):item.image && item.image[0] ? item.image[0].file_path : ''}`"
                    alt=""
                    draggable="false"
                  ></div>
                <div class="detail">
                  <p class="title  line-hide"><span v-if="custormItemData.style.name == '1'">{{(custormItemData.params.choostype == '3'|| custormItemData.params.choostype == '1')?'这里是商品标题':item.edit?item.edit.title:item.goods_name}}</span></p>
                  <div class="flex-col progress-box">
                        <p class="progress"><span class="progress-num">还剩1000</span></p>
                  </div>
                  <div class="sales-num">
                    <div class="flex-row flex-justify-b flex-align-c">
                      <div class="subtitle line-hide">
                      <p v-if="custormItemData.params.choostype == '3' || custormItemData.params.choostype == '1'">
                        <span class="sub-price" v-if="custormItemData.style.price == '1'"><span class="icon">￥</span>40.00</span>
                        <span class="sub-price line-through" v-if="custormItemData.style.oldprice == '1'"><span class="icon">仅剩10件</span></span>
                      </p>
                      <p v-if="custormItemData.params.choostype == '2'">
                        <span class="sub-price" v-if="custormItemData.style.price == '1'"><span class="icon">￥</span>{{item.edit?item.edit.price:item.price}}</span>
                        <span class="sub-price line-through" v-if="custormItemData.style.oldprice == '1'"><span class="icon">仅剩{{item.edit?item.edit.sales:item.stock}}件</span></span>
                      </p>
                  </div>
                      <div class="sales-btn flex-row flex-align-c">
                        <span>马上抢</span>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
              <!-- ---- -->
            </div>

          </div>
        </div>

      </div>

      <div
        class="btn-edit-del"
        @click="delCurrent"
      ><span class="btn-del iconfont icon icon-close"></span></div>
    </div>
  </section>
</template>

<script>
import defaultConfig from './utils/showConfig'
export default {
  mixins: [defaultConfig.mixins],
  props: {
    defaultConfig: {
      type: Object,
      default: function() {
        return defaultConfig
      }
    }
  },
  methods: {

  }
}
</script>

<style lang="scss" scoped>
.custorm--modelbox.marketspike-show {
  .flex,
  .flex-column {
    display: -webkit-box;
    display: -webkit-flex;
    display: -ms-flexbox;
    display: flex;
  }

  .es-seckill-group.style-row .es-seckill-title {
    margin: 20px 20px 6px;
    height: 22px;
    font-size: 11px;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
  }

  .es-seckill-group.style-row .es-seckill-title .title {
    .seckill-title{
        font-size: 18px;
        font-weight: 700;
        color: #3d404d;
        background: #fff;
    }
    font-size: 12px;
    img{
        vertical-align: middle;
        zoom: .5;
    }
    &+p{
            border: 1px solid #fe504f;
    border-radius: 3px;
    transform: scale(.9);
        margin-right: -5px;
    }
  }

  .es-seckill-group.style-row .es-seckill-title span {
    background: #fff;
    display: inline-block;
    color: #333;
    text-align: center;
    line-height: 18px;
    width: 17px;
  }

  .es-seckill-group.style-row .es-seckill-title span:first-of-type {
    width: auto;
    background: #fe504f;
    color: #fff;
    font-size: 12px;
    margin-right: 8px;
    padding: 1px 3px;
  }

  .es-seckill-group.style-row .group {
    overflow: hidden;

    & > div {
      font-size: 0;
    }
  }

  .es-seckill-group.style-row .group .es-seckill-col {
    display: inline-block;
    padding: 0 0 0 20px;
    width: 152px;
    box-sizing: border-box;
    border-radius: 2px;
    &:nth-of-type(even){
        margin-left: 10px;
    }
    .image {
        position: relative;
        height: 130px;
        margin: 4px 0 8px;
        width: 100%;
        border: 1px solid #e5e5e5;
        border-radius: 10px;
        img {
            height: 130px;
            width: 130px;
            object-fit: cover;
            border-radius: 10px;
            display: block;
        }
    }
  }

  .es-seckill-group.style-row .group .es-seckill-col .image span {
    line-height: 16px;
    padding: 0 6px;
    border-radius: 0 5px 0 0;
    background: #fd463e;
    color: #fff;
    position: absolute;
    display: none;
    bottom: 0;
    left: 0;
    font-weight: 700;
    font-size: 12px;
  }

  .es-seckill-group.style-row .group .es-seckill-col .detail {
    width: 100%;
    font-size: 12px;
    padding-bottom: 20px;
    .title{
        height: 21px;
        font-size: 14px;
    }
    .subtitle{
        height: 24px;
        line-height: 1;
        .sub-price{
            font-size: 14px;
            .icon{
                font-size: 12px;
            }
            &:not(.line-through){
                font-size: 20px;
                color: #fd463e;
                font-weight: 600;
            }
            &.line-through{
                color: #999;
                text-decoration: none;
            }
        }
    }
    .sales-num{
        .num {
            font-size: 14px;
            color: #999;
        }
        .progress{
            width: 50px;
            height: 10px;
            border-radius: 10px;
            line-height: 10px;
            background: rgb(242,242,242);
            .progress-num{
                display: inline-block;
                background: #fd463e;
                width: 40%;
                height: 10px;
                border-radius: 10px;
            }
        }
        // .sales-btn{
        //     border: 1px solid #fd463e;
        //     color: #fd463e;
        //     padding: 0 10px;
        //     border-radius: 30px;
        //     font-size: 14px;
        //     height: 26px;
        // }
    }
  }

  .es-seckill-group.style-row .group .es-seckill-col .detail .price .num {
    color: #999ca7;
    font-size: 9px;
    line-height: 25px;
    margin-left: 6px;
  }

  .es-seckill-group.style-row .group .es-seckill-col .detail .price .flex {
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
  }

  .es-seckill-group.style-row .group .es-seckill-col .detail .price span {
    font-size: 16px;
  }

//   style2
.es-seckill-group.style-col .es-seckill-title {
    background-image:url();
    background-repeat:no-repeat;
    background-size:100% 100%;
    height: 40px;
    padding:0 0 0 10px;
    font-size: 11px;
    -webkit-box-pack: justify;
    -webkit-justify-content: space-between;
    -ms-flex-pack: justify;
    justify-content: space-between;
    -webkit-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
  }

  .es-seckill-group.style-col .es-seckill-title .title {
    font-size: 12px;
    .seckill-title{
        font-size: 18px;
        font-weight: 700;
        color: #fff;
    }
    img{
        vertical-align: middle;
        zoom: .5;
    }
    &+p{
            border: 1px solid #fe504f;
    border-radius: 3px;
    transform: scale(.9);
    color: #fff;
        margin-right: -5px;
    }
  }

  .es-seckill-group.style-col .es-seckill-title span {
    background: #fff;
    display: inline-block;
    color: #333;
    text-align: center;
    line-height: 20px;
    width: 20px;
    border-radius: 3px;
  }

  .es-seckill-group.style-col .es-seckill-title span:first-of-type {
    width: auto;
    background: transparent;
    color: #fff;
    margin-right: 8px;
    padding: 1px 3px;
  }

  .es-seckill-group.style-col .group {
    overflow: hidden;

    & > div {
      white-space: nowrap;
      font-size: 0;
    }
  }

  .es-seckill-group.style-col .group .es-seckill-col {
    padding: 15px;
    box-sizing: border-box;
    border-radius: 2px;
    // border-bottom: 1px solid #999;
    padding-bottom: 12px;
    .image {
        position: relative;
        height: 97px;
        margin: 4px 0 8px;
        border: 1px solid #e5e5e5;
        border-radius: 5px;
        img {
            height: 95px;
            width: 95px;
            object-fit: cover;
            border-radius: 10px;
            display: block;
        }
    }
  }

  .es-seckill-group.style-col .group .es-seckill-col .image span {
    line-height: 16px;
    padding: 0 6px;
    border-radius: 0 5px 0 0;
    background: #fd463e;
    color: #fff;
    position: absolute;
    display: none;
    bottom: 0;
    left: 0;
    font-weight: 700;
    font-size: 12px;
  }

  .es-seckill-group.style-col .group .es-seckill-col .detail {
    width: 100%;
    font-size: 12px;
    margin-left: 15px;
    margin-right: 0;
    .title{
        font-size: 16px;
        height: 40px;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 215px;
    }
    .subtitle{
        .sub-price{
            font-size: 14px;
            .icon{
                font-size: 12px;
            }
            &:not(.line-through){
                font-size: 20px;
                color: #fd463e;
                font-weight: 600;
            }
            &.line-through{
                color: #999;
                text-decoration: line-through;
            }
        }
    }
    .progress-box{
        position: relative;
        height: 15px;
        margin-bottom: 15px;
        .progress{
                width: 55%;
                height: 15px;
                border-radius: 10px;
                line-height: 16px;
                text-align:center;
                background-color:#f7cfcd;
                .progress-num{
                  color:#fff;
                    display: inline-block;
                    height: 15px;
                    border-radius: 10px;
            }
        }
    }

    .sales-num{
        .sales-btn{
            border: 1px solid #fd463e;
            color: #fd463e;
            padding: 0 10px;
            border-radius: 30px;
            font-size: 14px;
            height: 26px;
        }
    }
  }

  .es-seckill-group.style-col .group .es-seckill-col .detail .price .num {
    color: #999ca7;
    font-size: 9px;
    line-height: 25px;
    margin-left: 6px;
  }

  .es-seckill-group.style-col .group .es-seckill-col .detail .price .flex {
    -webkit-box-pack: start;
    -webkit-justify-content: flex-start;
    -ms-flex-pack: start;
    justify-content: flex-start;
  }

  .es-seckill-group.style-col .group .es-seckill-col .detail .price span {
    font-size: 16px;
  }
}
</style>
